home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / sound / sb01.zip / SB.DOC < prev    next >
Text File  |  1994-06-30  |  4KB  |  100 lines

  1.  
  2.     1.INTRODUCTION
  3.  
  4.     First of all : SORRY for not including sb.c in the first
  5.     uploaded zipfile. What a silly mistake {-(
  6.  
  7.     This is a package for recording and playing sounds on
  8.     a DOS machine, using djgpp. It uses buffered DMA play,
  9.     so in principle you can do what you like once you
  10.     started playing the sound. In this special version I
  11.     implemented a loop, waiting for a keypress and correctly
  12.     ending playing/recording. Look at the sb_play/sb_rec
  13.     routines. Everything in the 'while(sb_dma_active)' loop
  14.     is not vital and could be removed, including the while
  15.     itself. The calling function then would be responsible
  16.     for making sure if the sound is finished or not.
  17.     Of course, in that case the sb_cleanup_ints must also be
  18.     transferred to that function and be called AFTER all
  19.     playing is finished. You cannot just install the interrupts
  20.     at the start of the program and leave them hanging around,
  21.     as playing and recording use different interrupt routines!
  22.     Hopefully this is finally a stable version, I tested it
  23.     with all kinds of files in several environments and it
  24.     worked flawlessly.
  25.     Improvements or error reports to the following adress :
  26.     kordmann@ldv01.Uni-Trier.de
  27.  
  28.  
  29.     2.SUPPORTED
  30.  
  31.     The program was written for an 8-bit Soundblaster or
  32.     compatible card. The data is therefore stored in an
  33.     array of unsigned char. 16 or 32 bit or whatever
  34.     samples won't work. Feel free to modify the code if
  35.     you need it, I don't know how to do it.
  36.     As it runs under go32, it allows you to record as much
  37.     sound as fits in your memory. If your machine has 8MB
  38.     and you want to record at 20KHz eg, that would make
  39.     about 5 minutes, depending on memory usage of your
  40.     program, TSRs and the environment.
  41.  
  42.     3.USAGE
  43.  
  44.     ATTENTION : due to a bug in go32, your machine may crash
  45.     when you use these routines. There is a fix for this by
  46.     Grzegorz Jablonski. See patch.txt for it. This is true
  47.     for go32 1.11.maint5, later versions may be OK.
  48.  
  49.     Before anything else, call sb_init. It will return the
  50.     address of your soundcard if successful, 0 else.
  51.     In most cases, I guess, it will suffice to use the two
  52.     routines SoundPlay and SoundRec, both with the
  53.     parameters  Rate : int, the sampling rate
  54.             data : unsigned char *, where the sound is
  55.             stored. Must be allocated before calling
  56.             SoundPlay or SoundRec
  57.             length : unsigned long, length of data in byte
  58.     When you don't need the functions anymore, or before leaving
  59.     the program, call sb_cleanup to free the memory used.
  60.  
  61.     The included program main.c gives a short example how to
  62.     calculate length and how to call the functions.
  63.     Usage is : main [<filename.wav>] [-r [-f<samplingrate>][-t<time>]]
  64.  
  65.     filename : if not given defaults to 'test.wav'
  66.     -r : recording mode. Only then the other options are valid
  67.     -f : sampling rate (or frequency) in Hertz (samples per second)
  68.          defaults to 12000
  69.     -t : recording time in miliseconds, defaults to 2000
  70.  
  71.     4.FILES
  72.  
  73.     sb.c : the library routines as such
  74.     sb.h : header file for the library
  75.     main.c : example program for recording and playing .wav files
  76.     wave.c : routines for reading and writing .wav files
  77.     makefile : makes the example program using gcc, executable sound
  78.     patch.txt : contains a bugfix for go32 1.11.maint5
  79.  
  80.     5.ERRORS
  81.  
  82.     I did not test it under windows. As this marvellous ;->
  83.     product crashes about everything there might be some kind
  84.     or the other of a problem...
  85.     There definitely is a slight choppyness in the recorded
  86.     soundfiles where the DMA buffers switch. I would be glad
  87.     if anybody found a remedy and would inform me. There
  88.     may be the problem that for high sampling rates recording
  89.     is a bit too slow. I had this fixed once but it happened
  90.     again recently, I'm not sure why... Try compiling with
  91.     -O2, I dimly remember that could help.
  92.  
  93.     6. THANKS
  94.  
  95.     The basic code is mainly from David Baggett, who again based
  96.     it on SoundBlaster Freedom project and linux code. Without
  97.     the bugfixes of Grzegorz Jablonski nothing would have been
  98.     possible, and of course without D.J.Delories port of the
  99.     gcc compiler written by... and so on
  100.